package com.ruoyi.project.system.donation.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.donation.mapper.MemberDonationMapper;
import com.ruoyi.project.system.donation.domain.MemberDonation;
import com.ruoyi.project.system.donation.service.IMemberDonationService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 爱心捐赠Service业务层处理
 * 
 * @author LCL
 * @date 2020-12-24
 */
@Service
public class MemberDonationServiceImpl implements IMemberDonationService 
{

    @Autowired
    private IdGererateFactory idGererateFactory;

    @Autowired
    private MemberDonationMapper memberDonationMapper;

    /**
     * 查询爱心捐赠
     * 
     * @param id 爱心捐赠ID
     * @return 爱心捐赠
     */
    @Override
    public MemberDonation selectMemberDonationById(String id)
    {
        return memberDonationMapper.selectMemberDonationById(id);
    }

    /**
     * 查询爱心捐赠列表
     * 
     * @param memberDonation 爱心捐赠
     * @return 爱心捐赠
     */
    @Override
    public List<MemberDonation> selectMemberDonationList(MemberDonation memberDonation)
    {
        return memberDonationMapper.selectMemberDonationList(memberDonation);
    }

    /**
     * 新增爱心捐赠
     * 
     * @param memberDonation 爱心捐赠
     * @return 结果
     */
    @Override
    public int insertMemberDonation(MemberDonation memberDonation)
    {
        memberDonation.setId(this.idGererateFactory.nextStringId());
        return memberDonationMapper.insertMemberDonation(memberDonation);
    }

    /**
     * 修改爱心捐赠
     * 
     * @param memberDonation 爱心捐赠
     * @return 结果
     */
    @Override
    public int updateMemberDonation(MemberDonation memberDonation)
    {
        return memberDonationMapper.updateMemberDonation(memberDonation);
    }

    /**
     * 删除爱心捐赠对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberDonationByIds(String ids)
    {
        return memberDonationMapper.deleteMemberDonationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除爱心捐赠信息
     * 
     * @param id 爱心捐赠ID
     * @return 结果
     */
    @Override
    public int deleteMemberDonationById(String id)
    {
        return memberDonationMapper.deleteMemberDonationById(id);
    }

    @Override
    public Map findCountByUid(String uid) {
        return memberDonationMapper.findCountByUid(uid);
    }
}
